package org.parngon.maze;

import java.awt.Point;
import java.awt.Dimension;
import java.awt.Rectangle;

public class RectangularArea
{
  public static int BLOCK = 1;
  public static int VOID = 2;

  Point topLeft = null;
  Point bottomRight = null;
  int type = 0;

  Rectangle bounds = null;

  public RectangularArea(Point p1, Point p2, int t)
  {
    topLeft = new Point(Math.min(p1.x, p2.x), Math.min(p1.y, p2.y));
    bottomRight = new Point(Math.max(p1.x, p2.x), Math.max(p1.y, p2.y));

    bounds = new Rectangle(topLeft, new Dimension(bottomRight.x - topLeft.x + 1, bottomRight.y - topLeft.y + 1));

    type = t;
  }

  public Dimension getSize()
  {
    return bounds.getSize();
  }

  public Rectangle getBounds()
  {
    return new Rectangle(bounds);
  }

  public int getType()
  {
    return type;
  }

  public static void main(String argv[])
  {
    RectangularArea ra1 = new RectangularArea(new Point(3, 4), new Point(7, 8), 1);
    System.out.println(ra1.getBounds());
    System.out.println(ra1.getBounds().contains(new Point(7, 8)));
  }
}
